package com.rd.student.jike.class4.wanghaixin.test0727;

import java.io.File;

public class TestFile {
    public static void main(String[] args) {
        //创建一个File集合，指代某个具体的文件
        //路径分隔符  FIle.separator
        File f1 = new File("D:"+File.separator+"JavaCode/Code"+File.separator+"corecode"+File.separator+"src"+File.separator+"TestAtomic\\zrrd\\test0727\\jsv");
        System.out.println(f1.length());//文件大小

        File f2 = new File("D:"+File.separator+"JavaCode/Code"+File.separator+"corecode"+File.separator+"src"+File.separator+"TestAtomic\\zrrd\\test0727");
        System.out.println(f2.length());
        System.out.println(f2.exists());
        //File可以指带不存在的文件路劲
        File f3 = new File("D:"+File.separator+"JavaCode/Code"+File.separator+"corecode"+File.separator+"src"+File.separator+"TestAtomic\\zrrd\\test0727\\aa.txt");
        System.out.println(f3.length());
        System.out.println(f3.exists());//false

        //相对路劲不带盘符直接在工程下默认去寻找文件
        File f4 = new File("corecode\\src\\TestAtomic\\zrrd\\test0727\\jsv.txt");
        System.out.println(f4.length());
        System.out.println(f4.exists());
    }
}
